/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86183
 * Date: 2024-03-31
 * Time: 18:01
 */
public class Test {
    public static void main(String[] args) throws InterruptedException {
        Object locker1=new Object();
        Object locker2=new Object();
        Object locker3=new Object();
        Thread a=new Thread(()->{
            synchronized (locker1){
                try {
                    locker1.wait();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                System.out.println("   a   ");

            }
        });
        Thread b=new Thread(()->{
            synchronized (locker2){
                try {
                    locker2.wait();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                System.out.println("   b   ");

            }
        });
        Thread c=new Thread(()->{
            synchronized (locker3){
                try {
                    locker3.wait();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                System.out.println("   c   ");

            }
        });
       Thread d=new Thread(()->{
           synchronized (locker3){
               locker3.notify();
           }
           try {
               Thread.sleep(1000);
           } catch (InterruptedException e) {
               e.printStackTrace();
           }
           synchronized (locker2){
               locker2.notify();
           }
           try {
               Thread.sleep(1000);
           } catch (InterruptedException e) {
               e.printStackTrace();
           }
           synchronized (locker1){
               locker1.notify();
           }


       });
        a.start();
        b.start();
        c.start();
        Thread.sleep(5000);
        d.start();

    }
}
